package com.viknix.threadpool.manager.example;

import com.viknix.threadpool.manager.client.annotations.EnableThreadPoolManager;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.core.env.ConfigurableEnvironment;

import java.net.InetAddress;

/**
 * @Author: Dongqi
 * @Date: 2021/10/21 14:22
 * @Version 1.0
 * @Description: 样板项目main函数
 */
@Slf4j
@EnableThreadPoolManager
@SpringBootApplication
public class ClientApplication {

    public static void main(String[] args) {
        ConfigurableEnvironment env = SpringApplication.run(ClientApplication.class, args).getEnvironment();
        String local = null;
        try {
            InetAddress localHost = InetAddress.getLocalHost();
            local = localHost.getHostAddress();
        } catch (Exception e) {
            log.warn(">>> 😭 localHost is null！");
            local = "127.0.0.1";
        }
        String port = env.getProperty("server.port");
        log.info(">>> 😀 Access URLs:\n----------------------------------------------------------\n\t"
                + "Local: \t\thttp://{}:{}\n\t", local, port);
    }
}
